<template>
  <div id="outline">
    <div class="main">
      <Row>
        <!-- 大标题 -->
        <Col span="24" class="maxTitle">{{stepInfo.maxTitle}}</Col>
      </Row>
      <Row>
        <!-- 标题下方描述 -->
        <Col span="24" class="desc">{{stepInfo.desc}}</Col>
      </Row>
      <Row>
        <Col span="2">&nbsp;</Col>
        <Col span="20">
        <!-- 时间线组件 -->
          <Timeline pending>
            <!-- 此方法限制选好次数 -->
            <TimelineItem                  
              v-for="(step,index) in more?stepInfo.steps:stepInfo.steps.slice(0, 3)"
              :key="index"
            >
                <!-- 阶段标题 -->
              <h3 class="stepTitle">{{step.title}}</h3>
                  <!-- 阶段描述 -->
              <span class="stepDesc">{{step.stepDesc}}</span>
              <p v-for="(item,index) in step.items" :key="index" v-html="item"></p>
            </TimelineItem>
              <!-- 查看更多 -->
            <TimelineItem>
              <a href="javascript:void(0)" @click="changeMore()" ref="more" class="more">点击查看更多</a>
            </TimelineItem>
          </Timeline>
        </Col>
        <Col span="2">&nbsp;</Col>
      </Row>
    </div>
  </div>
</template>

<script>
//导入iview-ui组件
import { Row, Col, Timeline, TimelineItem } from "view-design";

export default {
  name: "outline",
  //组件注册
  components: {
    Row,
    Col,
    Timeline,
    TimelineItem
  },
  //传入属性
  props:['stepInfo'],
  data() {
    return {
      //查看更多切换变量
      more: false,
      
    };
  },
  computed: {},
  watch: {},
  methods: {
    //查看更多事件
    changeMore() {
      if (this.more) {
        this.$refs.more.innerText = "点击查看更多";
      } else {
        this.$refs.more.innerText = "收起";
      }
      this.more = !this.more;
    }
  },
  created() {},
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {} //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>

<style scoped>
/* 局部UI样式修改 */
.main {
  background-color: #091744;
  color: white;
  padding: 40px 0;
}
.maxTitle {
  text-align: center;
  font-size: 24px;
  font-weight: 500;
}
.desc {
  text-align: center;
  font-size: 16px;
  margin: 10px auto 45px;
}
.stepTitle {
  font-size: 16px;
  font-weight: 700;
}
.stepDesc {
  display: inline-block;
  margin: 15px 0;
}
p {
  line-height: 20px;
}
.more {
  color: #fa6240;
}
</style>